package com.project2.controller;

import com.project2.bean.ResultVo;
import com.project2.bean.vo.StatCountVo;
import com.project2.service.StatService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author: MH
 * @Date: 2022-08-12 19:11
 * @Description: 统计报表
 */
@RestController
@RequestMapping("admin/stat")
public class AdminStatController {
    @Autowired
    StatService statService;

    @RequestMapping("goods")
    @RequiresPermissions("admin:stat:goods")
    public ResultVo goodsCount(){
        StatCountVo statCountVo = statService.goodsCount();
        return ResultVo .ok(statCountVo);
    }

    @RequestMapping("order")
    @RequiresPermissions("admin:stat:order")
    public ResultVo ordersCount(){
        StatCountVo statCountVo = statService.ordersCount();
        return ResultVo .ok(statCountVo);
    }

    @RequestMapping("user")
    @RequiresPermissions("admin:stat:user")
    public ResultVo usersCount(){
        StatCountVo statCountVo = statService.usersCount();
        return ResultVo .ok(statCountVo);
    }
}
